package orbitPrototype.gui;

import orbitPrototype.event.EventHandler;

/**
 * Description:	Base class of ALL buttons. Should be extended to add more complex interactive elements
 * 				such as hover-over buttons and such.
 * 
 * @author Drapan
 *
 */

public class GUISimpleButton extends GUIInteractiveElement
{
	private String _actionLabel = "";
	private Object _actionTarget = null;

	public GUISimpleButton(int x, int y, int width, int height, String actionLabel, Object actionTarget, GUIWindow parentWindow)
	{
		super(x, y, width, height, parentWindow);
		_actionLabel = actionLabel;
		_actionTarget = actionTarget;
	}
	
	@Override
	public void action()
	{
		if(!_actionLabel.equals(""))
		{
			if(_actionTarget != null)
			{
				EventHandler.triggerEvent(_actionLabel, _actionTarget);
			}
			else
			{
				EventHandler.triggerEvent(_actionLabel);
			}
		}
	}

	public String getActionLabel()
	{
		return _actionLabel;
	}
}
